<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  
  <title>【总结】两个月的工作任务总结 | 程序小工  | Just do it!</title>
  <meta name="description" content="遇见更好的自己~" />
  <meta name="keywords" content="" />
  <meta name="HandheldFriendly" content="True" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="shortcut icon" href="/">
  <link rel="alternate" href="/atom.xml" title="程序小工  | Just do it!">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="从 2018.4.2 工作以来，不知不觉已经工作两个多月，并在昨天约谈从这个月开始转正。从刚开始的自己学习，到逐渐接触公司的项目，并完成交付的功能模块，学到了很多，也发现了自己存在的不足，所以作此总结，激励自己，并鞭策自己，不骄不躁，不悲不怒，养成良好的心态，并坚持学习，保持热情！">
<meta name="keywords" content="工作总结">
<meta property="og:type" content="article">
<meta property="og:title" content="【总结】两个月的工作任务总结">
<meta property="og:url" content="http://blog.i2arch.tech/2018/06/20/summary-monthly2/index.html">
<meta property="og:site_name" content="程序小工  | Just do it!">
<meta property="og:description" content="从 2018.4.2 工作以来，不知不觉已经工作两个多月，并在昨天约谈从这个月开始转正。从刚开始的自己学习，到逐渐接触公司的项目，并完成交付的功能模块，学到了很多，也发现了自己存在的不足，所以作此总结，激励自己，并鞭策自己，不骄不躁，不悲不怒，养成良好的心态，并坚持学习，保持热情！">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-08-14T07:59:24.570Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="【总结】两个月的工作任务总结">
<meta name="twitter:description" content="从 2018.4.2 工作以来，不知不觉已经工作两个多月，并在昨天约谈从这个月开始转正。从刚开始的自己学习，到逐渐接触公司的项目，并完成交付的功能模块，学到了很多，也发现了自己存在的不足，所以作此总结，激励自己，并鞭策自己，不骄不躁，不悲不怒，养成良好的心态，并坚持学习，保持热情！">
    
  <link href="https://fonts.googleapis.com/css?family=Inconsolata|Titillium+Web" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href='//cdn.bootcss.com/node-waves/0.7.5/waves.min.css' rel='stylesheet'>
  <link rel="stylesheet" href="/style.css">
  <script>
    function setLoadingBarProgress(num) {
      document.getElementById('loading-bar').style.width=num+"%";
    }
  </script>
</head>

<body>
  <div id="loading-bar-wrapper">
  <div id="loading-bar"></div>
</div>


  <script>setLoadingBarProgress(20)</script>
  <header class="l_header">
	<div class='wrapper'>
		<div class="nav-main container container--flex">
			<a class="logo flat-box" href='/' >
				程序小工  | Just do it!
			</a>
			<div class='menu'>
				<ul class='h-list'>
					
						<li>
							<a class='flat-box nav-home' href='/'>
								<i class='icon icon-list2'></i>
								首页
							</a>
						</li>
					
						<li>
							<a class='flat-box nav-archives' href='/archives'>
								<i class='icon icon-bookmark'></i>
								归档
							</a>
						</li>
					
						<li>
							<a class='flat-box nav-about' href='/about'>
								<i class='icon icon-user'></i>
								关于
							</a>
						</li>
					
				</ul>
				<div class='underline'></div>
			</div>
			
				<div class="m_search">
					<form name="searchform" class="form u-search-form">
						<input type="text" class="input u-search-input" placeholder="Search" />
						<span class="icon icon-search"></span>
					</form>
				</div>
			
			<ul class='switcher h-list'>
				
					<li class='s-search'><a href='javascript:void(0)'><span class="icon icon-search flat-box"></span></a></li>
				
				<li class='s-menu'><a href='javascript:void(0)'><span class="icon icon-menu flat-box"></span></a></li>
			</ul>
		</div>

		<div class='nav-sub container container--flex'>
			<a class="logo" class="flat-box" href='javascript:void(0)'>
				Word of Forks
			</a>

			<ul class='switcher h-list'>
				<li class='s-comment'><a href='javascript:void(0)'><span class="icon icon-chat_bubble_outline flat-box"></span></a></li>
				<li class='s-top'><a href='javascript:void(0)'><span class="icon icon-arrow_upward flat-box"></span></a></li>
				<li class='s-toc'><a href='javascript:void(0)'><span class="icon icon-format_list_numbered flat-box"></span></a></li>
			</ul>
		</div>
	</div>
</header>
<aside class="menu-phone">
	<nav>
		
			<a href="/" class="nav-home nav">
				首页
			</a>
		
			<a href="/archives" class="nav-archives nav">
				归档
			</a>
		
			<a href="/about" class="nav-about nav">
				关于
			</a>
		
	</nav>
</aside>

    <script>setLoadingBarProgress(40);</script>
  <div class="l_body">
    <div class='container clearfix'>
      <!-- 左侧内容 -->
      <div class='l_main'>
        <article id="post-summary-monthly2"
  class="post white-box article-type-post"
  itemscope itemprop="blogPost">
	<section class='meta'>

	<h2 class="title">
  	<a href="/2018/06/20/summary-monthly2/">
    	【总结】两个月的工作任务总结
    </a>
	</h2>

	<div class="pagenav">
		<time>
			2018-06-20
		</time>

		
    
    <div class='cats'>
        <i class="icon icon-bookmark"></i>
        <a href="/categories/工作总结/">工作总结</a>
    </div>


		
			<div class="pagetags">
				<i class="icon icon-price-tag" style="margin-right: 2px;"></i>
				
					<a href="/tags/工作总结/" style="margin-left: 3px;">
						工作总结
					</a>
				
			</div>
			
	</div>
	</section>

	
	<section class="toc-wrapper"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#一-功能模块介绍"><span class="toc-text"> 一、功能模块介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1订单系统"><span class="toc-text"> 1.订单系统</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2商品入库"><span class="toc-text"> 2.商品入库</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-功能列表"><span class="toc-text"> (1) 功能列表</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-完成时长两个半星期"><span class="toc-text"> (2) 完成时长：两个半星期</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-难点整理"><span class="toc-text"> (3) 难点整理</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3sphinx-关键词检索"><span class="toc-text"> 3.sphinx 关键词检索</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1功能列表"><span class="toc-text"> (1)功能列表</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2完成时长-两天"><span class="toc-text"> 2.完成时长： 两天</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3难点介绍"><span class="toc-text"> 3.难点介绍</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4权限管理"><span class="toc-text"> 4.权限管理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-功能介绍"><span class="toc-text"> (1) 功能介绍</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-完成时长四天"><span class="toc-text"> (2) 完成时长：四天</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-难点介绍"><span class="toc-text"> (3) 难点介绍</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#二-自我反思"><span class="toc-text"> 二、自我反思</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1优点"><span class="toc-text"> 1.优点</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2缺点"><span class="toc-text"> 2.缺点</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#三-经验总结"><span class="toc-text"> 三、经验总结</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1如何快速理清需求"><span class="toc-text"> 1.如何快速理清需求？</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-看数据表数据字段之间名称的联系"><span class="toc-text"> (1) 看数据表，数据字段之间名称的联系</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-看已有的功能代码代码的实现逻辑"><span class="toc-text"> (2) 看已有的功能代码，代码的实现逻辑</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-走心的记住之前理出来的逻辑快速的重要前提"><span class="toc-text"> (3) 走心的记住之前理出来的逻辑（快速的重要前提）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2如何保持积极-热情"><span class="toc-text"> 2.如何保持积极、热情？</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-保持学习"><span class="toc-text"> (1) 保持学习</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-多反思自己少批评别人"><span class="toc-text"> (2) 多反思自己，少批评别人</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-尊重别人"><span class="toc-text"> (3) 尊重别人</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#四-代码展示"><span class="toc-text"> 四、代码展示</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1phpexcel-使用导出-excel"><span class="toc-text"> 1.PHPExcel 使用–导出 excel</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2sphinx-在-php-项目中的应用"><span class="toc-text"> 2.Sphinx 在 PHP 项目中的应用</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-sphinx-配置"><span class="toc-text"> 1). Sphinx 配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-公共方法封装"><span class="toc-text"> 2). 公共方法封装</span></a></li></ol></li></ol></li></ol></section>
	

	<section class="article typo">
		<div class="article-entry" itemprop="articleBody">
				<span class="zhaiyao">[摘要]</span>
			<p>从 2018.4.2 工作以来，不知不觉已经工作两个多月，并在昨天约谈从这个月开始转正。从刚开始的自己学习，到逐渐接触公司的项目，并完成交付的功能模块，学到了很多，也发现了自己存在的不足，所以作此总结，激励自己，并鞭策自己，不骄不躁，不悲不怒，养成良好的心态，并坚持学习，保持热情！</p>
<a id="more"></a>
<h1 id="一-功能模块介绍"><a class="markdownIt-Anchor" href="#一-功能模块介绍"></a> 一、功能模块介绍</h1>
<h2 id="1订单系统"><a class="markdownIt-Anchor" href="#1订单系统"></a> 1.订单系统</h2>
<ul>
<li>数据库关联 [6 张数据库的关联查询]
<ul>
<li>订单信息列表
<ul>
<li>订单信息表 — order</li>
<li>支付方式表 — paymentmethod</li>
<li>订单详情表 — orderlist</li>
<li>优惠券信息表 — coupon</li>
<li>快递信息表 — delivery</li>
<li>商城信息表 — shopcategory</li>
</ul>
</li>
<li>子订单信息列表 [一个订单有多个商品]
<ul>
<li>订单商品表 — ordergoods</li>
</ul>
</li>
<li>订单规格信息列表 [一个订单的一个商品有多个规格属性]
<ul>
<li>订单规格表 — orderspec</li>
</ul>
</li>
</ul>
</li>
<li>订单状态处理</li>
<li>订单导出到 excel</li>
</ul>
<h2 id="2商品入库"><a class="markdownIt-Anchor" href="#2商品入库"></a> 2.商品入库</h2>
<h3 id="1-功能列表"><a class="markdownIt-Anchor" href="#1-功能列表"></a> (1) 功能列表</h3>
<ul>
<li>
<p>关键词管理</p>
</li>
<li>
<p>选品管理</p>
</li>
<li>
<p>待入库商品[同时操作 2 个数据库，9 张数据表]</p>
<ul>
<li>
<p>COD 数据库</p>
<ul>
<li>系统商品表— offer [***套餐处理]</li>
<li>库存表 — stock</li>
<li>库存规格表— stocksku [****规格处理]</li>
<li>库存日志表— stocklog</li>
<li>库存分类表— stockcategory</li>
<li>库存仓库关联表— stockskuwarehouse</li>
<li>库存商品关联表— stockoffer</li>
<li>用户商品关联表— useroffer</li>
</ul>
</li>
<li>
<p>GOODS 数据库</p>
<ul>
<li>待入库商品状态更新— goods</li>
</ul>
</li>
</ul>
</li>
<li>
<p>运费模板管理</p>
</li>
</ul>
<h3 id="2-完成时长两个半星期"><a class="markdownIt-Anchor" href="#2-完成时长两个半星期"></a> (2) 完成时长：两个半星期</h3>
<h3 id="3-难点整理"><a class="markdownIt-Anchor" href="#3-难点整理"></a> (3) 难点整理</h3>
<ul>
<li>
<p>数据表相互关联关系的理解。</p>
<pre><code>  业务需求不懂，所以直接接触时不知道各个数据表之间的关系，以及需要如何处理已经有的信息
</code></pre>
</li>
<li>
<p>库存规格处理和套餐处理的结构</p>
<pre><code>  逻辑较复杂，加上第一次实现时没有对功能进行切分，代码混杂，耦合度高，导致后期需求调整时，对需要调整的需求无从下手
</code></pre>
</li>
</ul>
<h2 id="3sphinx-关键词检索"><a class="markdownIt-Anchor" href="#3sphinx-关键词检索"></a> 3.sphinx 关键词检索</h2>
<blockquote>
<p>集成开发环境由 phpStudy 转向 UPUPW ANK(后者有 sphinx 服务管理)</p>
</blockquote>
<h3 id="1功能列表"><a class="markdownIt-Anchor" href="#1功能列表"></a> (1)功能列表</h3>
<p>1). php 开启 sphinx 扩展</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># php.ini</span></span><br><span class="line"><span class="attr">extension</span>=php_sphinx.dll</span><br></pre></td></tr></table></figure>
<p>2). sphinx.conf 配置项配置</p>
<blockquote>
<p>source [type sql_host sql_user sql_pass sql_db sql_query_pre sql_query sql_attr_uint]</p>
</blockquote>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 设置查询条件</span></span><br><span class="line"><span class="attr">sql_attr_uint</span>   = status</span><br></pre></td></tr></table></figure>
<blockquote>
<p>index [source path charset_table ngram_len ngram_chars]</p>
</blockquote>
<p>3).sphinx 第三方类库的引入[ThinkPHP5 置于 extend 目录下]</p>
<ul>
<li>
<p>SphinxClient 类的使用</p>
</li>
<li>
<p>设置匹配记录条数的限制 (默认只检索 20 条）</p>
</li>
</ul>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$sphinx-&gt;setLimits(<span class="number">0</span>, <span class="number">1000</span>);</span><br></pre></td></tr></table></figure>
<ul>
<li>匹配模式的对比</li>
</ul>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 设置全文查询的匹配模式</span></span><br><span class="line">SphinxClient::setMatchMode</span><br></pre></td></tr></table></figure>
<table>
<thead>
<tr>
<th>模式</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>SPH_MATCH_ALL</td>
<td>匹配所有查询词（默认模式）.</td>
</tr>
<tr>
<td>SPH_MATCH_ANY</td>
<td>匹配查询词中的任意一个.</td>
</tr>
<tr>
<td>SPH_MATCH_PHRASE</td>
<td>将整个查询看作一个词组，要求按顺序完整匹配.</td>
</tr>
<tr>
<td>SPH_MATCH_BOOLEAN</td>
<td>将查询看作一个布尔表达式.</td>
</tr>
<tr>
<td>SPH_MATCH_EXTENDED</td>
<td>将查询看作一个 Sphinx 内部查询语言的表达式.</td>
</tr>
<tr>
<td>SPH_MATCH_FULLSCAN</td>
<td>使用完全扫描，忽略查询词汇.</td>
</tr>
<tr>
<td>SPH_MATCH_EXTENDED2</td>
<td>类似 SPH_MATCH_EXTENDED ，并支持评分和权重.</td>
</tr>
</tbody>
</table>
<ul>
<li>检索时设置条件过滤</li>
</ul>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$sphinx-&gt;SetFilter($filterkey, $filtervalue);</span><br></pre></td></tr></table></figure>
<h3 id="2完成时长-两天"><a class="markdownIt-Anchor" href="#2完成时长-两天"></a> 2.完成时长： 两天</h3>
<h3 id="3难点介绍"><a class="markdownIt-Anchor" href="#3难点介绍"></a> 3.难点介绍</h3>
<ul>
<li>
<p>对检索的结果设置检索条件[根据 status 查询]</p>
<pre><code>  - 对sphinx配置项不熟 =》 对某些参数的设定模棱两可，所以后期删除某些看似非必要配置项时导致功能不能实现(sphinx.conf 中source的配置项`sql_attr_uint`删除导致根据status查询的结果不正确)
  - 对SphinxClient的方法和属性不熟 =》 sphinx设置过滤的使用方法： $sphinx-&gt;SetFilter($filterkey, $filtervalue)
</code></pre>
</li>
<li>
<p>中文检索的支持</p>
<pre><code>  - 起初查找的资料都是介绍需要使用sphinx的coreseek扩展进行中文分词检索支持的，从而被带偏的一直查找coreseek的相关资料，而coreseek的官方网站又一直无法访问，导致无从下手，直到后来不断的调整配置，以及查找资料，才知道原来当前版本的sphinx已经默认支持中文分词的检索了，不再需要coreseek等其他扩展。使用索引源`sql_query_pre`设置编码和索引配置项`ngram_len` `ngram_chars`即可支持中文检索。
</code></pre>
</li>
</ul>
<h2 id="4权限管理"><a class="markdownIt-Anchor" href="#4权限管理"></a> 4.权限管理</h2>
<p><strong>RBAC</strong>(Role-Basied Access Control) 基于角色的权限访问控制–<strong>用户-角色-权限</strong>。</p>
<p>权限控制的实现 =》 url 形式 [<code>module/action</code>]</p>
<h3 id="1-功能介绍"><a class="markdownIt-Anchor" href="#1-功能介绍"></a> (1) 功能介绍</h3>
<p>1). 用户管理</p>
<pre><code>- 用户列表
- 用户创建
- 用户编辑 [ 编辑用户的基本信息 + 分配用户角色 ]
</code></pre>
<p>2). 角色管理</p>
<pre><code>- 角色列表
- 角色创建
- 角色编辑 [ 编辑角色的基本信息 + 分配角色权限 ]
</code></pre>
<p>3). 权限管理</p>
<pre><code>- 权限列表
</code></pre>
<p>4). 数据表(5 张)</p>
<ul>
<li>用户信息表 — account</li>
<li>角色信息表 — role</li>
<li>权限信息表 — auth</li>
<li>用户-角色关联表 — account_role</li>
<li>角色-权限关联表 — role_auth</li>
</ul>
<h3 id="2-完成时长四天"><a class="markdownIt-Anchor" href="#2-完成时长四天"></a> (2) 完成时长：四天</h3>
<h3 id="3-难点介绍"><a class="markdownIt-Anchor" href="#3-难点介绍"></a> (3) 难点介绍</h3>
<ul>
<li>
<p>角色分配和权限分配(封装到共用方法)</p>
<ul>
<li><strong>已经分配的角色|权限</strong> – 更新 — array_intersect</li>
<li>需要<strong>删除</strong>的角色|权限 – 删除 — array_diff</li>
<li>需要<strong>新增</strong>的角色|权限 – 新增 — array_diff</li>
</ul>
</li>
</ul>
<h1 id="二-自我反思"><a class="markdownIt-Anchor" href="#二-自我反思"></a> 二、自我反思</h1>
<h2 id="1优点"><a class="markdownIt-Anchor" href="#1优点"></a> 1.优点</h2>
<ul>
<li>
<p>能在完全不了解已有项目和已有功能的情况下，适应原有的代码风格，并理清所有逻辑和业务需求，有效完成功能任务，实践能力和思考能力达到了一个入门级程序员的水准（很 low）.</p>
</li>
<li>
<p>能认识到自己编写的代码有一定的不足[耦合度高，逻辑复杂]</p>
</li>
</ul>
<h2 id="2缺点"><a class="markdownIt-Anchor" href="#2缺点"></a> 2.缺点</h2>
<ul>
<li>
<p>代码质量不高</p>
<pre><code>  逻辑不够清晰，命名规范等不够好
</code></pre>
</li>
<li>
<p>容易形成固化的思维定式</p>
<pre><code>  在商品入库的结构调整时，被自己编写的代码绕晕了，而无从下手
</code></pre>
</li>
<li>
<p>效率不高</p>
<pre><code>  逻辑能力有待提高，有些东西稍微调整一下的时候就要重新理思路，导致效率低。并且对一些细节的知识掌握不清，模棱两可，从而这些细节导致出错时，无法及时排查，耽误时间。
</code></pre>
</li>
<li>
<p>不够走心</p>
<pre><code>  没有用心理清整个业务逻辑，主动性和积极性有待提高
</code></pre>
</li>
</ul>
<h1 id="三-经验总结"><a class="markdownIt-Anchor" href="#三-经验总结"></a> 三、经验总结</h1>
<h2 id="1如何快速理清需求"><a class="markdownIt-Anchor" href="#1如何快速理清需求"></a> 1.如何快速理清需求？</h2>
<h3 id="1-看数据表数据字段之间名称的联系"><a class="markdownIt-Anchor" href="#1-看数据表数据字段之间名称的联系"></a> (1) 看数据表，数据字段之间名称的联系</h3>
<ul>
<li>不要低估别人的数据表设计能力（如果已经有的话）</li>
<li>有效的利用工具</li>
<li>看哪些地方有用到这些数据表（数据表是为业务需求所设计）</li>
</ul>
<h3 id="2-看已有的功能代码代码的实现逻辑"><a class="markdownIt-Anchor" href="#2-看已有的功能代码代码的实现逻辑"></a> (2) 看已有的功能代码，代码的实现逻辑</h3>
<ul>
<li>不要低估别人的代码能力（如果已经有的话）</li>
<li>先整体后细节，业务逻辑不明白会使得对细节的理解有一定的难度，但整体上先大致的了解一个接口都干了哪些事会帮助理清逻辑。</li>
<li>对功能相同或相似的代码可以理解后直接使用，以效率为主</li>
</ul>
<h3 id="3-走心的记住之前理出来的逻辑快速的重要前提"><a class="markdownIt-Anchor" href="#3-走心的记住之前理出来的逻辑快速的重要前提"></a> (3) 走心的记住之前理出来的逻辑（快速的重要前提）</h3>
<ul>
<li>不要总是分神，养成专注和集中注意力的能力（保持思考）</li>
<li>不要情绪化，影响思考能力和专注度</li>
<li>注意休息</li>
</ul>
<h2 id="2如何保持积极-热情"><a class="markdownIt-Anchor" href="#2如何保持积极-热情"></a> 2.如何保持积极、热情？</h2>
<h3 id="1-保持学习"><a class="markdownIt-Anchor" href="#1-保持学习"></a> (1) 保持学习</h3>
<ul>
<li>养成沉浸式学习的能力，学进去，并消化理解，为实际工作中所用</li>
<li>不要娱乐化，娱乐八卦信息要多少有多少，要多乱有多乱，看了除了浪费时间没有其他任何益处，不如培养自己的兴趣，提升自己的内涵</li>
<li>多思考，多动手，实践是检验理论和巩固知识最有效的方式</li>
<li>学习带来的思维敏捷可以很大程度提升自我认可度</li>
</ul>
<h3 id="2-多反思自己少批评别人"><a class="markdownIt-Anchor" href="#2-多反思自己少批评别人"></a> (2) 多反思自己，少批评别人</h3>
<ul>
<li>被自己惯出来的优越感会让自己忘乎所以，尊重别人，就是对自己最大的尊重</li>
<li>让自己真正意义上的变优秀，才是真正值得自豪的事情，而不是通过对别人指指点点</li>
<li>理性待人，理性对事</li>
</ul>
<h3 id="3-尊重别人"><a class="markdownIt-Anchor" href="#3-尊重别人"></a> (3) 尊重别人</h3>
<ul>
<li>对别人给予的负面言论有则改之，无则加勉，无需上升到个人情绪的层面</li>
<li>别人错误的指责，表气（更加影响效率和状态）</li>
<li>一切为了提升自己，成为更好的自己</li>
</ul>
<h1 id="四-代码展示"><a class="markdownIt-Anchor" href="#四-代码展示"></a> 四、代码展示</h1>
<h2 id="1phpexcel-使用导出-excel"><a class="markdownIt-Anchor" href="#1phpexcel-使用导出-excel"></a> 1.PHPExcel 使用–导出 excel</h2>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 导出exml</span></span><br><span class="line"><span class="comment"> * expTitle 表格标题</span></span><br><span class="line"><span class="comment"> * expCellName 表格单元格列名</span></span><br><span class="line"><span class="comment"> * expTableData 数据</span></span><br><span class="line"><span class="comment"> * setWidth 单元格列宽</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">ExportExcel</span><span class="params">($expTitle, $expCellName, $expTableData, $setWidth, $output = <span class="number">0</span>, $i = <span class="number">1</span>)</span> </span>&#123;</span><br><span class="line">    $xlsTitle = iconv(<span class="string">'utf-8'</span>, <span class="string">'gb2312'</span>, $expTitle); <span class="comment">//文件名称</span></span><br><span class="line">    $fileName = $expTitle . date(<span class="string">'_YmdHis'</span>); <span class="comment">//or $xlsTitle 文件名称可根据自己情况设定</span></span><br><span class="line"></span><br><span class="line">    $cellNum = count($expCellName);</span><br><span class="line">    $dataNum = count($expTableData);</span><br><span class="line">    $objPHPExcel = <span class="keyword">new</span> \PHPExcel();</span><br><span class="line"></span><br><span class="line">    $cellName = <span class="keyword">array</span>(<span class="string">'A'</span>, <span class="string">'B'</span>, <span class="string">'C'</span>, <span class="string">'D'</span>, <span class="string">'E'</span>, <span class="string">'F'</span>, <span class="string">'G'</span>, <span class="string">'H'</span>, <span class="string">'I'</span>, <span class="string">'J'</span>, <span class="string">'K'</span>, <span class="string">'L'</span>, <span class="string">'M'</span>, <span class="string">'N'</span>, <span class="string">'O'</span>, <span class="string">'P'</span>, <span class="string">'Q'</span>, <span class="string">'R'</span>, <span class="string">'S'</span>, <span class="string">'T'</span>, <span class="string">'U'</span>, <span class="string">'V'</span>, <span class="string">'W'</span>, <span class="string">'X'</span>, <span class="string">'Y'</span>, <span class="string">'Z'</span>, <span class="string">'AA'</span>, <span class="string">'AB'</span>, <span class="string">'AC'</span>, <span class="string">'AD'</span>, <span class="string">'AE'</span>, <span class="string">'AF'</span>, <span class="string">'AG'</span>, <span class="string">'AH'</span>, <span class="string">'AI'</span>, <span class="string">'AJ'</span>, <span class="string">'AK'</span>, <span class="string">'AL'</span>, <span class="string">'AM'</span>, <span class="string">'AN'</span>, <span class="string">'AO'</span>, <span class="string">'AP'</span>, <span class="string">'AQ'</span>, <span class="string">'AR'</span>, <span class="string">'AS'</span>, <span class="string">'AT'</span>, <span class="string">'AU'</span>, <span class="string">'AV'</span>, <span class="string">'AW'</span>, <span class="string">'AX'</span>, <span class="string">'AY'</span>, <span class="string">'AZ'</span>);</span><br><span class="line">    $objPHPExcel-&gt;getActiveSheet(<span class="number">0</span>)-&gt;mergeCells(<span class="string">'A1:'</span> . $cellName[$cellNum - <span class="number">1</span>] . <span class="string">'1'</span>); <span class="comment">//合并单元格</span></span><br><span class="line">    $objPHPExcel-&gt;setActiveSheetIndex(<span class="number">0</span>)-&gt;setCellValue(<span class="string">'A1'</span>, <span class="string">''</span> . $expTitle . <span class="string">'  Export time:'</span> . date(<span class="string">'Y-m-d H:i:s'</span>));</span><br><span class="line">    $objPHPExcel-&gt;getDefaultStyle()-&gt;getFont()-&gt;setName(<span class="string">'Arial'</span>);</span><br><span class="line">    $objPHPExcel-&gt;getActiveSheet(<span class="number">0</span>)-&gt;getRowDimension(<span class="number">1</span>)-&gt;setRowHeight(<span class="number">40</span>);</span><br><span class="line">    $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle(<span class="string">"A1"</span>)-&gt;getFont()-&gt;setSize(<span class="number">20</span>);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> ($i = <span class="number">0</span>; $i &lt; $cellNum; $i++) &#123;</span><br><span class="line">        $objPHPExcel-&gt;setActiveSheetIndex(<span class="number">0</span>)-&gt;setCellValue($cellName[$i] . <span class="string">'2'</span>, $expCellName[$i][<span class="number">1</span>]);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> ($i = <span class="number">0</span>; $i &lt; $dataNum; $i++) &#123;</span><br><span class="line">        <span class="keyword">for</span> ($j = <span class="number">0</span>; $j &lt; $cellNum; $j++) &#123;</span><br><span class="line">            <span class="comment">//数据</span></span><br><span class="line">            $objPHPExcel-&gt;getActiveSheet(<span class="number">0</span>)-&gt;setCellValue($cellName[$j] . ($i + <span class="number">3</span>), $expTableData[$i][$expCellName[$j][<span class="number">1</span>]]);</span><br><span class="line"></span><br><span class="line">            <span class="keyword">for</span> ($j = <span class="number">0</span>; $j &lt; $cellNum; $j++) &#123;</span><br><span class="line">                $objPHPExcel-&gt;getActiveSheet(<span class="number">0</span>)-&gt;setCellValue($cellName[$j] . ($i + <span class="number">3</span>), $expTableData[$i][$expCellName[$j][<span class="number">0</span>]])-&gt;getRowDimension($i + <span class="number">3</span>);</span><br><span class="line">                <span class="keyword">foreach</span> ($setWidth <span class="keyword">as</span> $setWidthk =&gt; $setWidthvalue) &#123;</span><br><span class="line">                    $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension($setWidthk)-&gt;setWidth($setWidthvalue);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (<span class="keyword">empty</span>($output)) &#123;</span><br><span class="line">        header(<span class="string">'pragma:public'</span>);</span><br><span class="line">        header(<span class="string">'Content-type:application/vnd.ms-excel;charset=utf-8;name="'</span> . $xlsTitle . <span class="string">'.xls"'</span>);</span><br><span class="line">        header(<span class="string">"Content-Disposition:attachment;filename=$fileName.xls"</span>);</span><br><span class="line">        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, <span class="string">'Excel5'</span>);</span><br><span class="line">        $objWriter-&gt;save(<span class="string">'php://output'</span>);</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, <span class="string">'Excel5'</span>);</span><br><span class="line">        $file = ROOT_PATH . <span class="string">'public'</span> . DS . <span class="string">'uploads'</span> . DS . <span class="string">'temp'</span> . DS . <span class="string">'keywordstemp.'</span> . xls;</span><br><span class="line">        $objWriter-&gt;save($file);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">'&lt;script&gt;window.close();&lt;/script&gt;'</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="2sphinx-在-php-项目中的应用"><a class="markdownIt-Anchor" href="#2sphinx-在-php-项目中的应用"></a> 2.Sphinx 在 PHP 项目中的应用</h2>
<h3 id="1-sphinx-配置"><a class="markdownIt-Anchor" href="#1-sphinx-配置"></a> 1). Sphinx 配置</h3>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">source keyword</span><br><span class="line">&#123;</span><br><span class="line">    <span class="comment"># 配置数据库基本信息</span></span><br><span class="line">    charset_type    = mysql</span><br><span class="line">    sql_host        = 127.0.0.1</span><br><span class="line">    sql_user        = root</span><br><span class="line">    sql_pass        = 123123</span><br><span class="line">    sql_dbcharset_type  = goods</span><br><span class="line">    sql_query_pre   = SET NAMES utf8</span><br><span class="line"></span><br><span class="line">    sql_query       = \</span><br><span class="line">        SELECT id,status,keyword \</span><br><span class="line">        FROM goods</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 设置查询条件</span></span><br><span class="line">    sql_attr_uint   = status</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">index keyword</span><br><span class="line">&#123;</span><br><span class="line">    <span class="comment"># 指定配置的source</span></span><br><span class="line">    sourcecharset_type  = keyword</span><br><span class="line">    <span class="comment"># 指定索引数据文件存储路径</span></span><br><span class="line">    pathcharset_type    = /usr/local/spinx/var/data/keyword</span><br><span class="line">    <span class="comment"># 指定字符集(新版已废除)</span></span><br><span class="line">    charset_type    = utf-8</span><br><span class="line">    <span class="comment"># 检索的字符串编码识别范围</span></span><br><span class="line">    charset_table   = 0..9, A..Z-&gt;a..z, _, a..z, U+410..U+42F-&gt;U+430..U+44F, U+430..U+44F</span><br><span class="line">    <span class="comment"># 支持中文检索(值为1时支持中文，0时不支持中文)</span></span><br><span class="line">    ngram_len       = 1</span><br><span class="line">    <span class="comment"># 中文检索的字符编码范围</span></span><br><span class="line">    ngram_chars     = U+3000..U+2FA1F</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="2-公共方法封装"><a class="markdownIt-Anchor" href="#2-公共方法封装"></a> 2). 公共方法封装</h3>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * sphinx搜索</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> string $key 查询的字符串</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> string $indexFile 索引文件</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> string $filterkey 过滤字段名</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> string $filtervalue 过滤字段值</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return</span> mixed</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">sphinx</span><span class="params">($key, $indexFile, $filterkey = <span class="string">''</span>, $filtervalue = [])</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    $sphinx = <span class="keyword">new</span> \SphinxClient;</span><br><span class="line">    $sphinx-&gt;setServer(<span class="string">"localhost"</span>, <span class="number">9312</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 设置检索时的过滤条件</span></span><br><span class="line">    <span class="keyword">if</span> (!<span class="keyword">empty</span>($filterkey)) &#123;</span><br><span class="line">        $filterRes = $sphinx-&gt;SetFilter($filterkey, $filtervalue);</span><br><span class="line">        <span class="keyword">if</span> (!$filterRes) &#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 作为数组返回</span></span><br><span class="line">    $sphinx-&gt;SetArrayResult(<span class="keyword">true</span>);</span><br><span class="line">    <span class="comment">// 匹配格式  任意匹配</span></span><br><span class="line">    $sphinx-&gt;setMatchMode(SPH_MATCH_ALL);</span><br><span class="line">    $sphinx-&gt;setMaxQueryTime(<span class="number">3</span>);</span><br><span class="line">    $sphinx-&gt;setLimits(<span class="number">0</span>, <span class="number">1000</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 参数1：查询关键字， 参数2：索引名（所有索引用*）</span></span><br><span class="line">    $result = $sphinx-&gt;query($key, $indexFile);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (<span class="keyword">empty</span>($result[<span class="string">'matches'</span>])) &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> $result;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

		</div>

		
			<div class="art-item-footer">
					
						<span class="art-item-left"><i class="icon icon-chevron-thin-left"></i> <a href="/2018/06/22/vscode-background/" rel="prev" title="【VSCode插件】background添加编辑器背景">
							【VSCode插件】background添加编辑器背景
						</a>上一篇文章</span>
					
					
						<span class="art-item-right">下一篇文章：<a href="/2018/06/05/mysql-compare/" rel="next"  title="MySQL数据库常见名词对比">
							MySQL数据库常见名词对比
						</a><i class="icon icon-chevron-thin-right"></i></span>
					
			</div>
		

		
			

    <div class="recommended_posts">
        <h3>推荐文章</h3>
        <ul>
            
                <li><a href="http://blog.i2arch.tech/2018/06/29/windows-tool/">【转】windows系统下的高效工具</a></li>
            
                <li><a href="http://blog.i2arch.tech/2018/06/22/vscode-background/">【VSCode插件】background添加编辑器背景</a></li>
            
                <li><a href="http://blog.i2arch.tech/2018/06/05/mysql-compare/">MySQL数据库常见名词对比</a></li>
            
                <li><a href="http://blog.i2arch.tech/2018/05/16/php-无限级分类/">PHP实现无限级分类 -- path标识</a></li>
            
        </ul>
    </div>


		
	</section>

	

</article>
<script>
	window.subData = {
		title: '【总结】两个月的工作任务总结',
		tools: true
	}
</script>

      </div>

      <!-- 右侧边栏组件 -->
      <aside class='l_side'>
        
      </aside>

      <div class="gotop">
          
    <a href='javascript:void(0)'>
        <i class="icon icon-arrow_upward flat-box">
        </i>
    </a>

      </div>
      <script>setLoadingBarProgress(60);</script>
    </div>
  </div>
  <footer id="footer" class="clearfix">

	<div class="social-wrapper">
  	
      
        <a href="https://github.com/zqunor" class="social github"
          target="_blank" rel="external">
          <span class="icon icon-github"></span>
        </a>
      
        <a href="https://www.cnblogs.com/zqunor" class="social zhihu"
          target="_blank" rel="external">
          <span class="icon icon-zhihu"></span>
        </a>
      
        <a href="/atom.xml" class="social rss"
          target="_blank" rel="external">
          <span class="icon icon-rss"></span>
        </a>
      
    
  </div>
  <div>Theme <a href='https://github.com/stkevintan/hexo-theme-material-flow' class="codename">MaterialFlow</a>  Powered by<a href="https://blog.i2arch.tech/" target="_blank">程序小工</a>.</div>

</footer>

  <script>setLoadingBarProgress(80);</script>
  

    <script src="//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src='//cdn.bootcss.com/node-waves/0.7.5/waves.min.js'></script>
    <script src="//cdn.bootcss.com/scrollReveal.js/3.3.2/scrollreveal.min.js"></script>
    <script src="/js/jquery.fitvids.js"></script>
      <script>
        var GOOGLE_CUSTOM_SEARCH_API_KEY = "";
        var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "";
        var ALGOLIA_API_KEY = "";
        var ALGOLIA_APP_ID = "";
        var ALGOLIA_INDEX_NAME = "";
        var AZURE_SERVICE_NAME = "";
        var AZURE_INDEX_NAME = "";
        var AZURE_QUERY_KEY = "";
        var BAIDU_API_ID = "fca5b83cf69f752ddc96a61ef64a3659";
        var SEARCH_SERVICE = "hexo";
        var ROOT = "/" || "/";
        if (!ROOT.endsWith('/')) ROOT += '/';
      </script>
      <script src="/js/search.js"></script>
        <script src="/js/app.js"></script>
  <script>setLoadingBarProgress(100);</script>
</body>
</html>
